# $Id: PKGBUILD 78667 2012-10-22 14:23:25Z svenstaro $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Matthew Bowra-Dean <matthew@ijw.co.nz>
pkgname=openra
pkgver=20121019
pkgrel=1
pkgdesc="An open-source implementation of the Red Alert engine using .NET/mono and OpenGL"
arch=('any')
url="http://open-ra.org"
license=('GPL3')
install=openra.install
depends=('mono' 'openal' 'libgl' 'freetype2' 'sdl' 'hicolor-icon-theme' 'ttf-dejavu')
makedepends=('git' 'unzip')
optdepends=('nvidia-cg-toolkit: for using the alternative Cg renderer')
options=(!strip)
source=("openra-$pkgver::https://github.com/OpenRA/OpenRA/tarball/release-$pkgver")
md5sums=('9b4bcadcb9bf6f2ebb7e60a45dc56f2e')

build() {
  cd OpenRA-OpenRA-*

  make
}

package() {
  cd OpenRA-OpenRA-*

  mkdir -p "$pkgdir/usr/share/applications"
  sed "s/{VERSION}/$pkgver/g" packaging/linux/openra.desktop > "$pkgdir/usr/share/applications/openra.desktop"

  sed "/Version/s/{DEV_VERSION}/release-${pkgver}/" -i mods/{ra,cnc}/mod.yaml  

  mkdir -p "$pkgdir/usr/share/icons/"
  cp -r packaging/linux/hicolor "$pkgdir/usr/share/icons/"

  make prefix=/usr DESTDIR="$pkgdir" install

  find "$pkgdir" -iname \*.mdb -delete
}
